<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
  xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals"
  x:Class="OpenLS.Spreadsheet.UI.Internals.FormulaReferenceResources"
    >
  <ResourceDictionary.MergedDictionaries>
    <ssui:EditedCellColors/>
  </ResourceDictionary.MergedDictionaries>
  <DataTemplate DataType="{x:Type Internals:FormulaReference}"> 
    <Grid Name="referenceRangeGrid" MouseDown="onMouseDown" MouseUp="onMouseUp" MouseMove ="onMouseMove"
          Loaded="onLoaded">
      <Grid.Visibility>
        <MultiBinding Converter="{x:Static Internals:SpreadsheetConverters.MultiEqualConverter}">
          <Binding Path="Worksheet"/>
          <Binding Path="(ssui:SpreadsheetElement.Worksheet)" ElementName="referenceRangeGrid"/>
        </MultiBinding>
      </Grid.Visibility>
      <Rectangle StrokeThickness="1"  Cursor="SizeAll"  ssui:ResizeElement.ResizerType="Move" >
        <Rectangle.Stroke>
          <SolidColorBrush Color="{Binding Index, Converter={StaticResource icc}}"/>
        </Rectangle.Stroke>
      </Rectangle>
      <Rectangle StrokeThickness="3" Name="opt" Cursor="SizeAll"  ssui:ResizeElement.ResizerType="Move" >
        <Rectangle.Stroke>
          <SolidColorBrush Color="{Binding Index, Converter={StaticResource icc}}"/>
        </Rectangle.Stroke>
      </Rectangle>
      <Rectangle Width="5" Height="5" Margin="-2" HorizontalAlignment="Left" VerticalAlignment="Top" Cursor="SizeNWSE" ssui:ResizeElement.ResizerType="TopLeft" >
        <Rectangle.Fill>
          <SolidColorBrush Color="{Binding Index, Converter={StaticResource icc}}"/>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Width="5" Height="5" Margin="-2" HorizontalAlignment="Right" VerticalAlignment="Top"  Cursor="SizeNESW" ssui:ResizeElement.ResizerType="TopRight" >
        <Rectangle.Fill>
          <SolidColorBrush Color="{Binding Index, Converter={StaticResource icc}}"/>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Width="5" Height="5" Margin="-2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Cursor="SizeNESW" ssui:ResizeElement.ResizerType="BottomLeft" >
        <Rectangle.Fill>
          <SolidColorBrush Color="{Binding Index, Converter={StaticResource icc}}"/>
        </Rectangle.Fill>
      </Rectangle>
      <Rectangle Width="5" Height="5" Margin="-2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Cursor="SizeNWSE" ssui:ResizeElement.ResizerType="BottomRight" >
        <Rectangle.Fill>
          <SolidColorBrush Color="{Binding Index, Converter={StaticResource icc}}"/>
        </Rectangle.Fill>
      </Rectangle>
    </Grid>
    <DataTemplate.Triggers>
      <Trigger SourceName ="opt" Property ="IsMouseOver" Value ="False">
        <Setter TargetName ="opt" Property ="Stroke" Value ="Transparent"/>
      </Trigger>
    </DataTemplate.Triggers>
  </DataTemplate>
  <Style x:Key="formulaReferenceContainerStyle" TargetType="{x:Type FrameworkElement}" >
    <Setter Property="ssui:WorksheetGrid.Row" Value="{Binding Path=Row}"/>
    <Setter Property="ssui:WorksheetGrid.Column" Value="{Binding Path=Column}"/>
    <Setter Property="ssui:WorksheetGrid.RowSpan" Value="{Binding Path=RowSpan}"/>
    <Setter Property="ssui:WorksheetGrid.ColumnSpan" Value="{Binding Path=ColumnSpan}"/>
    <Setter Property="ssui:WorksheetGrid.IsFullRow" Value="{Binding Path=IsFullRow}"/>
    <Setter Property="ssui:WorksheetGrid.IsFullColumn" Value="{Binding Path=IsFullColumn}"/>
  </Style>
</ResourceDictionary>